<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script>

	
		var str = "hello javascriptjava";
		var patt = /java/;
		var pos = str.search(patt);
		console.log(pos);

		// var newstr = str.replace(patt,"world");
		// console.log("newstr="+newstr);


		// var arr = str.match(patt);
		// console.log(arr);

		var str = "hello javascriptjava";
var patt = /java/g;
var pos = str.replace(patt,"aaa");
console.log(pos);

	
	</script>
</body>
</html>